﻿@using Telerik.Web.Mvc.UI
@{    
    //page title
    ViewBag.Title = T("Admin.Configuration.Tax.Providers").Text;
}
<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
        @T("Admin.Configuration.Tax.Providers")
    </div>
</div>
<table class="adminContent">
    <tr>
        <td>
            @(Html.Telerik().Grid<TaxProviderModel>()
                    .Name("tax-providers-grid")
                    .DataKeys(x =>
                    {
                        x.Add(y => y.SystemName).RouteKey("systemName");
                    })
                    .Columns(columns =>
                    {
                        columns.Bound(x => x.FriendlyName);
                        columns.Bound(x => x.SystemName).Width(150);
                        columns.Bound(x => x.IsPrimaryTaxProvider)
                            .Template(
                                @<img alt="" src="@Url.Content("~/Administration/Content/images/active-" + item.IsPrimaryTaxProvider.ToString().ToLowerInvariant() + ".gif")" />
                            )
                            .ClientTemplate("<img alt='' src='" + Url.Content("~/Administration/Content/images/") + "active-<#= IsPrimaryTaxProvider #>.gif' />")
                            .Centered()
                            .Width(100)
                            .ReadOnly();
                        columns.Bound(x => x.SystemName)
                            .Template(x => Html.ActionLink(T("Admin.Configuration.Tax.Providers.Fields.MarkAsPrimaryProvider").Text, "MarkAsPrimaryProvider", new { systemName = x.SystemName }, new { @class = "t-button" }))
                            .ClientTemplate("<a href=\"" + @Url.Content("~/Admin/Tax/MarkAsPrimaryProvider") + "?systemName=<#= SystemName #>\" class=\"t-button\">" + T("Admin.Configuration.Tax.Providers.Fields.MarkAsPrimaryProvider").Text + "</a>")
                            .Centered()
                            .Width(200)
                            .HeaderTemplate(T("Admin.Configuration.Tax.Providers.Fields.MarkAsPrimaryProvider").Text);
                        columns.Template(
                                @<div>
                                    @Html.ActionLink(T("Admin.Configuration.Tax.Providers.Configure").Text, "ConfigureProvider", new { systemName = item.SystemName })
                                </div>
                            )
                            .ClientTemplate("<a href=\"ConfigureProvider?systemName=<#= SystemName #>\">" + T("Admin.Configuration.Tax.Providers.Configure").Text + "</a>")
                            .Width(100)
                            .Centered()
                            .Title(T("Admin.Configuration.Tax.Providers.Configure").Text);
                    })
                    .DataBinding(dataBinding =>
                    {
                        dataBinding.Ajax().Select("Providers", "Tax");
                    })
                    .EnableCustomBinding(true))
        </td>
    </tr>
</table>
